package ro.msg.quiz.Model;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;

import ro.msg.quiz.repository.Question;
import ro.msg.quiz.repository.Quiz;
import ro.msg.quiz.repository.RepositoryQuestion;
import ro.msg.quiz.repository.RepositoryQuiz;

public interface IQuizModel {
	/**
	 * @param questionRepo
	 *            setter for the question repository
	 */
	public void setQuestionRepo(RepositoryQuestion questionRepo);

	/**
	 * @return RepositoryQuestion getter for the QuestionRepository returns
	 *         object of type RepositoryQuestion
	 */
	public RepositoryQuestion getQuestionRepo();

	/**
	 * @return setter for the quiz repository return an object of type
	 *         RepositoryQuiz
	 */
	public RepositoryQuiz getQuizRepo();

	/**
	 * @param quizRepo
	 *            setter for the QuizRepository
	 */
	public void setQuizRepo(RepositoryQuiz quizRepo);

	/**
	 * getter for the map QuizQuestions where links are made
	 * 
	 * @return object of type Map<Integer, ArrayList<Integer>>
	 */
	public Map<Integer, ArrayList<Integer>> getQuizQuestions();

	/**
	 * setter for the QuizQuestions list the map where links are made
	 * 
	 * @param quizQuestions
	 */
	public void setQuizQuestions(Map<Integer, ArrayList<Integer>> quizQuestions);

	/**
	 * Iterator for the Question Repository
	 * 
	 * @return Iterator<Question>
	 * 
	 */
	public Iterator<Question> QuestionIterator();

	/**
	 * Iterator for the Quiz Repository
	 * 
	 * @return Iterator<Quiz>
	 */
	public Iterator<Quiz> QuizIterator();

	/**
	 * Adds a question to the question repository.Does not change the map
	 * 
	 * @param q
	 */
	public void addQuestion(Question q);

	/**
	 * Removes a question from the question repository and all the links in the
	 * map which had this question are dissolved
	 * 
	 * @param ques
	 * @return true if the question could be removed and false in other cases
	 */
	public boolean removeQuestion(int ques);

	/**
	 * Add a quiz to the quiz repository and in the map it creates a new key
	 * with the value of the quiz's id and the value is an empty list of
	 * Questions
	 * 
	 * @param v
	 */
	public void addQuiz(Quiz v);

	/**
	 * Removes a quizz from the repository and from the map too
	 * 
	 * @param a
	 */
	public void removeQuiz(int a);

	/**
	 * Checks if a quiz exists in the map
	 * 
	 * @param q
	 * @return
	 */
	public boolean QuizQuestionExists(Quiz q);

	/**
	 * Adds a question to the quiz.THe id of the questions is added in the list
	 * of id's of the map at the key Quizid
	 * 
	 * @param quiz
	 * @param ques
	 * @return
	 */
	public boolean addQuestionToQuiz(Integer quiz, Integer ques);

	/**
	 * It removes the quiz from the quiz but not from the QuestionRepository
	 * 
	 * @param quiz
	 * @param ques
	 * @return
	 */
	public boolean removeQuestionFromQuiz(Integer quiz, Integer ques);

	/**
	 * It prints the map
	 * 
	 */
	public void printMap();

	/*
	 * read from file relations between quiz and questions
	 */

	public void readFromFileQuizQuestion(String path);

	/*
	 * write to file quizQuestionsOut.txt
	 */
	public void writeToFileQuizQuestion(String path);

	/*
	 * all Write to file txt methods
	 */
	public void ExportTxt(String path);
}
